package com.onlinepay.enums;


public enum ScoinPayEnum {
    DATA_INIT_ERROR(1000, "数据初始化失败"),
    AREA_LIMIT_M_CARD_TRADE(2036, "地区限制M卡交易"),
    VISA_CHANNEL_UNAVAILABLE(2003, "visa通道不可用"),
    MASTER_CHANNEL_UNAVAILABLE(2002, "master通道不可用"),
    JCB_CHANNEL_UNAVAILABLE(2023, "jcb通道不可用"),
    AE_CHANNEL_UNAVAILABLE(2024, "ae通道不可用"),
    DINERS_CHANNEL_UNAVAILABLE(2030, "diners通道不可用"),
    DISCOVER_CHANNEL_UNAVAILABLE(2031, "discover通道不可用"),
    UNIONPAY_CHANNEL_UNAVAILABLE(2032, "unionpay通道不可用"),
    BANK_NOT_EXISTS(2005, "银行不存在"),
    ENCRY_CARD_ERROR(2016, "加密卡号出问题"),
    SUCCESS_TIMES_LIMIT(2017, "成功次数限制"),
    FAIL_TIMES_LIMIT(2038, "失败次数超过设定最大允许失败次数(持卡人)"),
    CHANNEL_UNAVAILABLE(2006, "通道暂时不可使用"),
    BLACK_LIST_PREVENT(2020, "黑名单阻止"),
    RESTRICTION_CARD(2019, "限制卡"),
    STOP_RULE_LIMIT(2018,"阻止规则阻止"),
    ELEMENT_LIMIT(2033, "元素限定"),
    TRANSBOUNDARY_TRADE(2034, "跨界交易"),
    COUNTRY_SYSTEM_EXCEPTION(2092, "检查IP对应的国家系统异常"),
    HIGH_RISK(2088, "高风险"),
    GENERAT_GOODS_INFO_ERROR(2028, "生成货物信息有误"),
    GENERAT_UPDATE_TRADE_FAIL(2022, "生成更新交易记录失败"),
    DELAY_PAYMENT(3887, "延时支付,订单失效"),
    SYSTEM_ERROR(9999, "系统异常"),
    RESUBMIT(2001, "刷新阻止(重复提交)"),
    MERCHANT_NOT_EXIST(1118, "商户不存在"),
    MERCHANT_NOT_ACTIVE(1120, "商户未激活"),
    MERCHANT_NOT_EMPTY(1104, "商户不能为空"),
    SIGN_ERROR(1105, "SignInfo校验错误"),
    AMOUNT_FORMAT_ERROR(1110, "金额格式错误"),
    CURRENCY_TRANSFORM_RATE_NOT_EXIST(2015, "币种转换汇率不存在"),
    TEST_ACCOUNT_CANNOT_GREATER_THAN_FIVE_DOLLAR(1111, "测试帐户最大支付金额不能超过5美金(折合人民币35元以下)"),
    WEBSITE_NOT_COMPLIANCE(1121, "来源网址不符合相关规定"),
    MERCHANT_WEBSITE_ERROR(1114, "查询商户网址限定时出错"),
    MERCHANT_WEBSITE_NOT_EXIST(1115, "商户网址限定"),
    MERCHANT_ORDER_NO_REPEAT(1112, "商户订单号重复"),
    CURRENCY_NOT_SET(1106, "没有设置币种"),
    CURRENCY_NOT_OPEND(1107, "币种未开通或币种传入有误"),
    CARD_TYPE_NOT_BIND(2007, "卡种未绑定"),
    OUT_OF_TRADE_COUNT_OF_DAY(2046, "超出每日交易笔数限制"),
    OUT_OF_TRADE_COUNT_OF_MONTH(2047, "超出每月交易笔数限制"),
    BAIL_RATE_NOT_SET(2025, "没有设置保证金扣率"),
    CHANNEL_DISABLE(2048, "通道被禁用"),
    MERCHANT_NOT_SET_CARD_RATE(2026, "没有设置商户卡种扣率"),
    NOT_SUPPORT_CARD_TRADE(2039, "暂不支持该卡交易"),
    RESTRICTION_CARD_SYSTEM_EXCEPTION(2091, "检查商限制卡系统异常"),
    MAXMIND_INSERT_FAIL(2021, "Maxmind数据插入失败"),
    IP_COUNTRY_LIMIT(2027, "IP国家限制"),
    BANK_SUBMIT_CVV_EMPTY(3002,"银行提交页面CVV为空"),
    BANK_SUBMIT_CARD_NO_EXCEPTION(3003, "银行提交页面卡号异常"),
    BANK_SUBMIT_CARD_EXPIRE_OF_MONTH(3004, "银行提交页面有效期(月)异常"),
    BANK_SUBMIT_CARD_EXPIRE_OF_YEAR(3005, "银行提交页面有效期(年)异常"),
    REPEAT_PAY(3012, "重复支付拦截，过滤重复提交银行订单"),
    QUOTA_USED_OUT(3013, "所有额度已用完"),
    REMAIN_SITE_TYPE_QUOTA_NOT_ENOUGH(3014, "配置的网站类型剩余额度已不足以支持该笔交易"),
    NOT_PAY_TYPE(2006,"未开通支付方式"),
    UNRECOGNIZED_CARD_TYPE(2200, "无法识别的卡类型");
    private int code;

    private String message;

    ScoinPayEnum(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }


    public static String findByCodeMsg(int code){
        for (ScoinPayEnum scoinPayEnum : ScoinPayEnum.values()) {
            if(code == scoinPayEnum.getCode()){
                return scoinPayEnum.getMessage();
            }
        }
       return null;
    }
}
